﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using PeopleSource.Entities;
using System.Data.Entity.ModelConfiguration.Conventions;
using PeopleSource.Entities;

namespace PeopleSource.Utl
{
    public class DB : DbContext
    {
        public DbSet<JobTitle> JobTitles { get; set; }
        public DbSet<PeopleSourceRole> PeopleSourceRoles { get; set; }
        public DbSet<Resume> Resumes { get; set; }
        public DbSet<ResumeType> ResumeTypes { get; set; }
        public DbSet<InterviewState> InterviewStates { get; set; }
        public DB(string connection = null)
        {
           // Database.SetInitializer<DB>(new DropCreateDatabaseIfModelChanges<DB>());

            Database.SetInitializer<DB>(null);
            //if (!string.IsNullOrEmpty(connection))
            //    this.Database.Connection.ConnectionString = connection;

            this.Configuration.LazyLoadingEnabled = true;
            this.Configuration.ValidateOnSaveEnabled = false;
        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
        }

     



    }
 
    public class DBAccount : DbContext
    {
        public DbSet<EmployeeRole> EmployeeRoles { get; set; }
        public DbSet<Role> Roles { get; set; }
        public DbSet<Department> Departments { get; set; }
        public DbSet<ExpLevel> ExpLevels { get; set; }

        public DBAccount(string connection = null)
        {
            // Database.SetInitializer<DB>(new DBInitializer());
            Database.SetInitializer<DBAccount>(null);
            //if (!string.IsNullOrEmpty(connection))
            //    this.Database.Connection.ConnectionString = connection;

            this.Configuration.LazyLoadingEnabled = true;
            this.Configuration.ValidateOnSaveEnabled = false;
        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
        }
    }
}